package com.example.module_home.adapter

import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.example.module_home.R
import com.example.module_home.entity.DeviceOrderEntityItem

class DeviceOrderAdapter: BaseQuickAdapter<DeviceOrderEntityItem, BaseViewHolder>(R.layout.item_device_order) {
    override fun convert(holder: BaseViewHolder, item: DeviceOrderEntityItem) {
        holder.getView<TextView>(R.id.device_deviceType).text="设备类别: ${item.orderType}"
        val status=holder.getView<TextView>(R.id.device_status)
        holder.getView<TextView>(R.id.device_failureRate).text="内容:${item.content}"
        holder.getView<TextView>(R.id.device_installationLocation).text="安装地点: ${item.address}"
        status.text=item.status
        if(item.status=="新建"){
            status.setBackgroundResource(com.example.lib_resource.R.color.common_color_blue)
        }else if(item.status=="进行中"){
            status.setBackgroundResource(R.drawable.devices_error_bg)
        }else if(item.status=="已完成"){
            status.setBackgroundResource(com.example.lib_resource.R.color.red)
        }else if(item.status=="已转派"){
            status.setBackgroundResource(com.example.lib_resource.R.color.blueviolet)
        }
    }

}